﻿// Copyright © Microsoft Corporation.  All Rights Reserved.
// This code released under the terms of the 
// Microsoft Public License (MS-PL, http://opensource.org/licenses/ms-pl.html.)
//
//Copyright (C) Microsoft Corporation.  All rights reserved.

 // See the ReadMe.html for additional information

namespace SampleQueries
{
    using System;
    using System.Collections.Generic;
    using System.Windows.Forms;
    using DataSetSampleQueries;
    using SampleSupport;

    internal static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        private static void Main(string[] args)
        {
            var harnesses = new List<SampleHarness>();

            // LinqSamples:
            var linqHarness = new LinqSamples();
            harnesses.Add(linqHarness);

            // Linq To SQL Samples:
            var linqToSqlHarness = new LinqToSqlSamples();
            harnesses.Add(linqToSqlHarness);

            // LinqToXmlSamples:
            var linqToXmlHarness = new LinqToXmlSamples();
            harnesses.Add(linqToXmlHarness);

            // DataSetLinqSamples:
            var dsLinqSamples = new DataSetLinqSamples();
            harnesses.Add(dsLinqSamples);

            // XQueryUseCases:
            var xqueryHarness = new XQueryUseCases();
            harnesses.Add(xqueryHarness);

            if (args.Length >= 1 &&
                args[0] == "/runall")
            {
                foreach (var harness in harnesses)
                {
                    harness.RunAllSamples();
                }
            }
            else
            {
                Application.EnableVisualStyles();

                using (var form = new SampleForm("LINQ Project Sample Query Explorer", harnesses))
                {
                    form.ShowDialog();
                }
            }
        }
    }
}